<?php

class Skjb_Search_Xapian_Document
{
    public $_cPtr=null;

    function __construct($other=null) {
        switch (func_num_args()) {
        case 0: $r=new_Document(); break;
        default: $r=new_Document($other);
        }
        $this->_cPtr=$r;
    }

    function get_value($valueno) {
        return Document_get_value($this->_cPtr,$valueno);
    }

    function add_value($valueno,$value) {
        Document_add_value($this->_cPtr,$valueno,$value);
    }

    function remove_value($valueno) {
        Document_remove_value($this->_cPtr,$valueno);
    }

    function clear_values() {
        Document_clear_values($this->_cPtr);
    }

    function get_data() {
        return Document_get_data($this->_cPtr);
    }

    function set_data($data) {
        Document_set_data($this->_cPtr,$data);
    }

    function add_posting($tname,$tpos,$wdfinc=1) {
        Document_add_posting($this->_cPtr,$tname,$tpos,$wdfinc);
    }

    function add_term($tname,$wdfinc=1) {
        Document_add_term($this->_cPtr,$tname,$wdfinc);
    }

    function remove_posting($tname,$tpos,$wdfdec=1) {
        Document_remove_posting($this->_cPtr,$tname,$tpos,$wdfdec);
    }

    function remove_term($tname) {
        Document_remove_term($this->_cPtr,$tname);
    }

    function clear_terms() {
        Document_clear_terms($this->_cPtr);
    }

    function termlist_count() {
        return Document_termlist_count($this->_cPtr);
    }

    function termlist_begin() {
        $r=Document_termlist_begin($this->_cPtr);
        return is_resource($r) ? new Skjb_Search_Xapian_TermIterator($r) : $r;
    }

    function termlist_end() {
        $r=Document_termlist_end($this->_cPtr);
        return is_resource($r) ? new Skjb_Search_Xapian_TermIterator($r) : $r;
    }

    function values_count() {
        return Document_values_count($this->_cPtr);
    }

    function values_begin() {
        $r=Document_values_begin($this->_cPtr);
        return is_resource($r) ? new Skjb_Search_Xapian_ValueIterator($r) : $r;
    }

    function values_end() {
        $r=Document_values_end($this->_cPtr);
        return is_resource($r) ? new Skjb_Search_Xapian_ValueIterator($r) : $r;
    }

    function get_docid() {
        return Document_get_docid($this->_cPtr);
    }

    function get_description() {
        return Document_get_description($this->_cPtr);
    }
}